﻿
Imports std
Imports storoomc
Imports storcore.storoomCallbackManager

Public Interface storoomThreadModel
    Function capacity(ByRef cap As UInt64, ByVal slices As vector(Of storageInterface)) As Boolean
    Function shareTypeCapacity(ByRef cap As UInt64, ByVal slices As vector(Of storageInterface)) As Boolean
    Function close(ByVal slices As vector(Of storageInterface)) As Boolean
    Function delete(ByVal key As String, ByVal slices As vector(Of storageInterface)) As Boolean
    Function empty(ByVal slices As vector(Of storageInterface)) As ternary
    Function full(ByVal slices As vector(Of storageInterface)) As ternary
    Function shareTypeFull(ByVal slices As vector(Of storageInterface)) As ternary
    Function keycount(ByRef count As UInt64, ByVal slices As vector(Of storageInterface)) As Boolean
    Function list(ByVal l As vector(Of String), ByVal slices As vector(Of storageInterface)) As Boolean
    Function open(ByVal slices As vector(Of storageInterface)) As Boolean
    Function read(ByVal key As String, ByRef buff As bytes, ByVal slices As vector(Of storageInterface)) As Boolean
    Function retire(ByVal slices As vector(Of storageInterface)) As Boolean
    Function seek(ByVal key As String, ByVal slices As vector(Of storageInterface)) As ternary
    Function sizeof(ByVal key As String, ByRef size As UInt64, ByVal slices As vector(Of storageInterface)) As Boolean
    Function valuesize(ByRef size As UInt64, ByVal slices As vector(Of storageInterface)) As Boolean
    Function write(ByVal key As String, ByVal buff As bytes, ByVal slice As storageInterface) As Boolean
    Function singleThreadWork(ByVal d As _do(Of Boolean)) As Boolean
    Function callbackManager() As storoomCallbackManager
End Interface

Public Enum jobType
    capacity = 0
    close
    delete
    empty
    full
    keycount
    list
    open
    read
    retire
    seek
    sizeof
    valuesize
    write

    count
End Enum

Public Module _storoomThreadModel
    Private ReadOnly jobTypeString() As String = Nothing

    Sub New()
        ReDim jobTypeString(jobType.count - 1)
        For i As Int64 = 0 To jobType.count - 1
            jobTypeString(i) = [Enum].GetName(GetType(jobType), i)
        Next
    End Sub

    Public Function jobType_String(ByVal jobType As jobType) As String
        Return jobTypeString(jobType)
    End Function
End Module
